package com.likou.written.shenzhou;

import java.util.Scanner;

/**
 * Author: 陈桂明
 * Date: 2025/10/9 17:19
 * Description: shenzhou1
 */
public class shenzhou1 {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        // while (in.hasNextInt()) { // 注意 while 处理多个 case
        //     int a = in.nextInt();
        //     int b = in.nextInt();
        //     System.out.println(a + b);
        // }

        int n = in.nextInt();
        for (int i = 0; i < n; i++) {
            int A = in.nextInt();
            int B = in.nextInt();
            int ans = B + A * B;
            System.out.println(ans);
        }
    }
}
